<?php echo $this->load->view('meta'); ?>
<title>xa-ncsu | calendar</title>
<?php echo $this->load->view('header'); ?>
<div id="welcome">
<?php if(isset($calendar_info['items'])) : ?>

	<?php foreach($calendar_info['items'] as $item) : ?>
		<?php echo $item; ?>
	<?php endforeach; ?>

<?php endif; ?>
	<h3><?=date("l F j, Y",strtotime($event->start))?></h3><br />
<?$a = (strtotime($event->end) - strtotime($event->start))/(60*60*24);?>
<? if($a<1 && $a>0): ?>
<?= $event->name?> @ <?=date("g:i a",strtotime($event->start))?> until <?=date("g:i a",strtotime($event->end))?>
<? elseif($a===0) : ?>
<?= $event->name?> - an all day event
<? else :?>
<?= $event->name?> @ <?=date("g:i a",strtotime($event->start))?> on <?=date("l",strtotime($event->start))?> until <?=date("g:i a",strtotime($event->end))?>  on <?=date("l",strtotime($event->end))?>
<? endif ?>

<p>Place: <?=$event->building;?>; <? if($event->geocode!=""): ?> <a href="<?=site_url("calendar/map/$event->geocode/$event->geocode2/")?>" title="Map of Event" class="thickbox" id="map"> <? endif; ?>
	<?= ($event->street!="") ? "$event->street; " : "" ?>
	<?= ($event->city!="") ? (strtolower($event->city)!="raleigh") ?  "$event->city," : "$event->city" : "" ?>
	<?= ($event->state!="" && strtolower($event->city)!="raleigh") ? "$event->state" : ""?><? if($event->geocode!=""): ?> </a> <? endif; ?>
</p>
<p><?= $event->description?></p>
<? if($invited) : ?>
<p><?= $con_user->display?> you are currently <?=$status?></p>
<? endif ?>
<? if($event->geocode!=""): ?>
<p style="margin-top:5px;"><a href="<?=site_url("calendar/map/$event->geocode/$event->geocode2/")?>" title="Map of Event" class="thickbox" name="map">View Map</a></p>
<br />
<? endif; ?>
</div>
<br />
<div id="items" class="home_col">
	
	<?php if($items->num_rows() > 0): ?>
	<h1>items</h1>
	<ul>
		<? foreach($items->result() as $row): ?>
		<li>
			<a href="<?=site_url("calendar/assignItem/$row->id")?>"><?=$row->name?> <?=$row->user?></a> 
		</li>
		<? endforeach; ?>
	</ul>
	<? endif; ?>

</div>
<br />

<?php if ($coming->num_rows() > 0 || $maybeComing->num_rows() > 0 || $notComing->num_rows() > 0): ?>
<div id="home_panel" class="clearfix">
	<div class="home_col">
		<h1>attending</h1>
		<?php if ($coming->num_rows() > 0): ?>
		<ul>
			<?php foreach ($coming->result() as $row): ?>
				<li>
					<a href="<?=site_url()?>users/profile/<?=$row->user_id?>" ><span><?=$row->author?></span></a>
				</li>
			<?php endforeach; ?>
		</ul>
		<?php endif; ?>
	</div>
	<div class="home_col">
		<h1>maybe attending</h1>
		<?php if ($maybeComing->num_rows() > 0): ?>
		<ul>
			<?php foreach ($maybeComing->result() as $row): ?>
				<li>
					<a href="<?=site_url()?>users/profile/<?=$row->user_id?>" ><span><?=$row->author?></span></a>
				</li>
			<?php endforeach; ?>
		</ul>
		<?php endif; ?>
	</div>
	<div class="home_col">
		<h1>not attending</h1>
		<?php if ($notComing->num_rows() > 0): ?>
		<ul>
			<?php foreach ($notComing->result() as $row): ?>
				<li>
					<a href="<?=site_url()?>users/profile/<?=$row->user_id?>" ><span><?=$row->author?></span></a>
				</li>
			<?php endforeach; ?>
		</ul>
		<?php endif; ?>
	</div>
</div>
<? endif; ?>
<?php echo $this->load->view('footer'); ?>